package com.woniuxy.api;


import com.woniuxy.common.Result;
import com.woniuxy.form.UpdUserForm;
import com.woniuxy.form.UserFinanceForm;
import com.woniuxy.form.UserForm;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(value = "user",contextId = "user")
public interface UserApi {
    /**
     * 注册
     * @param form
     * @return
     */
    @PostMapping("/register")
    Result register(@RequestBody UserForm form);

    /**
     * 账号密码登录
     * @param username
     * @param password
     * @return
     */
    @GetMapping("/loginByPassword")
    Result loginByPassword(@RequestParam("username") String username,@RequestParam("password") String password);


    /**
     * 短信登录
     * @param telPhoneNumber 手机号
     * @param check 验证码
     * @return
     */
    @GetMapping("/loginByCheck")
    Result loginByCheck(@RequestParam("telPhoneNumber") String telPhoneNumber,@RequestParam("check") String check);

    /**
     * 发送短信
     * @param tel
     * @return
     */
    @GetMapping("/sendMessage")
    Result sendMessage(@RequestParam("tel") String tel);

    /**
     * 修改个人资料
     * @param form
     * @return
     */
    @PutMapping("/updUser")
    Result updUser(@RequestBody UserForm form);

    /**
     * 增加用户积分
     * @param credit
     * @return
     */
    @PutMapping("/increaseCredit")
    Result increaseCredit(@RequestParam("credit") Integer credit,@RequestParam("userId") Integer userId);

    /**
     * 减少用户积分
     * @param credit
     * @return
     */
    @PutMapping("/cutBackCredit")
    Result cutBackCredit(@RequestParam("credit") Integer credit,@RequestParam("userId") Integer userId);


    /**
     * 用户增加成长值
     * @param growth
     * @return
     */
    @PutMapping("/increaseGrowthValue")
    Result increaseGrowthValue(@RequestParam("growth") int growth,@RequestParam("userId") int userId);



    /**
     * 查看账户余额
     * @param userId
     * @return
     */
    @GetMapping("/accountBalance")
    Result accountBalance(@RequestParam("userId") int userId);

    /**
     * 充值金额
     * @param form
     * @return
     */
    @PutMapping("/recharge")
    Result recharge(@RequestBody UserFinanceForm form);

    /**
     * 上传图片
     * @param poster
     * @return
     */
    @PostMapping("/upload")
    Result upload(@RequestBody MultipartFile poster);

    /**
     * 根据用户Id查询用户
     * @param userId
     * @return
     */
    @GetMapping("/findUser")
    Result findUser(@RequestParam("userId") int userId);


}
